<div class="col-md-8">
<div class="main-content" id="main-content">
	<div class="sub-content">
		<div class="top-header page-header clearfix">
			
				<h1>Bids List</h1>

		</div>
		<p id="messageStatus" style="color:green;display:none">Succussesfully chage the status.</p>		
		<div class="product_table table-responsive">	
		</div>
		<div class="spacer20">
			
				<div class="spacer20">&nbsp;</div>
						<div class="spacer20">						
					<a class="btn btn-danger" role="button" href="<? echo $this->Url('products')?>/bid-on-products">Back</a>
				</div>
			
		</div>
	</div>
</div> </div>
<input type="hidden" name="hid_product_id" id="hid_product_id" value="<?php if(isset($_GET['product'])){ echo $_GET['product'];}?>"/>
<script>

$(function(){
$('.product_table').html('Please wait loading....');
var bid_product=$("#hid_product_id").val();
	$.ajax({
		type:	'GET',
		dataType:'json',
		url:BASE_PATH+'/products/biddetailes-ajax?bid_product='+bid_product,
		success: function(data){
		$('.product_table').html('<table class="table table-bordered" cellpadding="0" cellspacing="0" width="100%" id="search_results"><thead><tr class="bg_header"><td>SNO</td><td>User Name</td><td width="77px;">Product Name</td><td>Bidding Price</td><td>Status</td><td>History</td></tr></thead><tbody></tbody></table>');	
		eval(data);
		var oTable = $('#search_results').dataTable( {
					aoColumnDefs: [{bSortable: false,
									aTargets: [ 0 ]
									}],
					"bStateSave": true,
					"bAutoWidth": true,
					"sRowSelect": "multi",
					"sPaginationType": "full_numbers",
					"bProcessing": true,
 					"aaData": data,
					"aoColumns": [
						{ "mData": "sno" },
						{ "mData": "companyname" },
						{ "mData": "genericname" },
						{ "mData": "biding_price" },
						{ "mData": "status" },
						//{ "mData": "action" },
						{ "mData": "history" },
					] 
				});			
		}
	});
});
function viewHistory(bid_id){
	var backId=$('#hid_product_id').val();
	window.location=BASE_URL+"/view-history?product="+bid_id+"&id="+backId+"&type=bid";					
}
function changeStatus(bid_id){
	var newStatus=$('#status'+bid_id).val();
	/*$.ajax({
		type:'POST',
		url:BASE_PATH+'/change-status-orders',
		data:{id:bid_id,newStatus:newStatus,type:'bid'},
		success: function(data){
			if(data.output=='success'){	
				$('#messageStatus').show().delay(4000).fadeOut();
			}
		}
	});*/
	window.location=BASE_URL+"/products/update-bidproduct-status?bid_id="+bid_id+"&status="+newStatus+"&type=bid";	
}
</script>